home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
ai
/
prlg195b.lzh
/
SAMPLES.LZH
/
ANS.PRO
next >
Wrap
Text File
|
1986-07-20
|
512b
|
21 lines
answer(A) :- ratom( X ), conv( X, A ), !.
conv(X,I) :- atoi( X, I ), 0 < I, I < 4, !.
conv(X,A) :- name( X, String ), valid_resp( String, A ), !.
valid_resp( [H|T], A ) :- type_ans( H, A ).
type_ans( X, A ) :- ([X] = "h"; [X] = "H"), A = help.
type_ans( X, A ) :- ([X] = "w"; [X] = "W"), A = why.
valid_resp( [], A ) :-
print('\nPlease try to give me a H,W, or number for an answer.'),
answer( A ), !.
valid_resp( [H|T], A ) :- valid_resp( T, A ).